//
//  SelePayReminderTableViewCell.swift
//  ZNZXSuperMarket
//
//  Created by 四川中农 on 2018/8/23.
//  Copyright © 2018年 四川中农. All rights reserved.
//

import UIKit

class SelePayReminderTableViewCell: UITableViewCell {
    
    @IBOutlet weak var reminderLabel: UILabel!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    func reload(withModel model:ConfirmOrderModel){
        let countDown = model.orders!.first!.endTime - (Date().timeIntervalSince1970)*1000
        let value = Utils.getMMSSFromSS(count: Int(countDown)/1000)
        var str = ""
        if value.0 != "00" {
            str = value.0 + "时"
        }
        
        if value.1 != "00" {
            str = str + value.1 + "分"
        }
        
        let attribute = NSMutableAttributedString.init(string: "请您尽快完成支付，待支付订单将在" + str + "后自动取消")
        attribute.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor.init(hexColor: "#fb2929"), range: NSString.init(string:"请您尽快完成支付，待支付订单将在" + str + "后自动取消").range(of: str))
        self.reminderLabel.attributedText = attribute
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
